package com.tianqu.tms.www.transfer.action;

import io.netty.util.internal.StringUtil;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tianqu.tms.core.base.TmsAction;
import com.tianqu.tms.core.base.UserContext;
import com.tianqu.tms.core.util.TmsConstants;
import com.tianqu.tms.www.transfer.controller.PublicSecurityAuditInputController;
import com.tianqu.tms.www.transfer.controller.PublicSecurityAuditResultController;
import com.tianqu.tms.www.transfer.viewhelper.PublicSecurityAuditInputViewHelper;

public class PublicSecurityAuditResultAction extends TmsAction {

	@Override
	protected ActionForward doAction(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response,
			UserContext uc) throws Exception {

		PublicSecurityAuditResultController controller = new PublicSecurityAuditResultController();
		controller.execute(uc);

		PublicSecurityAuditInputViewHelper view = (PublicSecurityAuditInputViewHelper) uc.getAttribute(TmsConstants.VIEWHELP);
		if (view == null) {
			view = new PublicSecurityAuditInputViewHelper();
		}
		request.setAttribute(VIEWHELP, view);	

		String next = (String)uc.getAttribute("next");
		if (!StringUtil.isNullOrEmpty(next)) {
			return mapping.findForward("next");
		}
		
		return mapping.findForward(TmsConstants.SUCCESS);
	}

}
